import request from "@/utils/request";
export default{
    getClassification(){
        return request.get("/classification",{
            method: "get",
        })
    },
    getSpecifiaId(subId){
        const params = {
            subId
        };
        return request.get("/classification/getClassification",{params},
            {
            method: "get",
        })
    },
    getClassificationList(pageNum,pageSize){
        const params = {
            pageNum,
            pageSize
        }
        return request.get("/classification/getClassificationListTable",{params},{
            method: "get",
        })
    },
    getClassificationListCount(){
        return request.get("/classification/getClassificationListCount",{
            method: "get",
        })
    },
    getSpecieClassification(pageNum,pageSize,id,isDeactivate){
        const params = {
            pageNum,
            pageSize,
            id,
            isDeactivate
        }
        console.log(params);
        return request.get("/classification/getSpecieClassification",{params},{
            method: "get",
        })
    },
    updateClassification(id){
        let params;
        if(typeof id === "number"){
            params = {
                id: [id]
            }
        }else{  
            params = {
                id: id
            }
        }
        console.log(params);
        return request.patch("/classification",params,{
            headers: {
                'Content-Type': 'application/json'
            },
            method: "patch",
        })
    },
    updateClassification1(id){
        let params;
        if(typeof id === "number"){
            params = {
                id: [id]
            }
        }else{  
            params = {
                id: id
            }
        }
        console.log(params);
        return request.patch("/classification/setClassificationIsDeactivate",params,{
            headers: {
                'Content-Type': 'application/json'
            },
            method: "patch",
        })
    },
    getClassificationCategory(){
        return request.get("/classification/getClassificationCategory",{
            method: "get",
        })
    },
    addClasssification(classificationSubcategoryAdd,classificationCategoryAdd){
        const params = {
            classificationSubcategoryAdd:classificationSubcategoryAdd,
            classificationCategoryAdd:classificationCategoryAdd
        }
        return request.post("/classification",params,{
            method: "post",
        })
    },
    setClassificationSubcategory0(id){
        let params;
        if(typeof id === "string"){
            params = {
                id: [id]
            }
        }else{  
            params = {
                id: id
            }
        }
        console.log("params");
        console.log(params);
        return request.patch("/classification/setClassificationSubcategoryIsDeactivate0",params,{
            headers: {
                'Content-Type': 'application/json'
            },
            method: "patch",
        })
    },
    setClassificationSubcategory1(id){
        let params;
        if(typeof id === "string"){
            params = {
                id: [id]
            }
        }else{  
            params = {
                id: id
            }
        }
        return request.patch("/classification/setClassificationSubcategoryIsDeactivate1",params,{
            headers: {
                'Content-Type': 'application/json'
            }
        })
    },
    getEditClassification(id){ 
        const params = {
            id
        }
        return request.get("/classification/getEditClassification",{params},{
            method: "get",
        })
    },
    updateClassificationCategory(editFrom){
        return request.patch("/classification/updateCategory",editFrom,{
            headers: {
                'Content-Type': 'application/json'
            },
            method: "patch",
        })
    },
    updateClassificationSubcategory(editFrom){ 
        return request.patch("/classification/updateSubcategory",editFrom,{
            headers: {
                'Content-Type': 'application/json'
            },
            method: "patch",
        })
    },
    getCategoryEcharts(){
        return request.get("/classification/getCategoryEcharts",{
            method:"get"
        })
    }
}